package com.github.caijh.mall.wechat.controller;

import com.github.caijh.framework.web.controller.BaseController;
import com.github.caijh.framework.wechat.model.WechatJsSdkConfig;
import com.github.caijh.mall.wechat.service.WeChatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController("WeChatAdminController")
@RequestMapping("api/admin/wechat")
@Api(tags = "微信 -- 开放平台 admin")
public class WeChatAdminController extends BaseController {

    @Autowired
    private WeChatService weChatService;

    @ApiOperation(value = "获取微信公众号js配置")
    @GetMapping(value = "/config")
    @ApiImplicitParam(name = "url", value = "页面地址url", dataTypeClass = String.class)
    public WechatJsSdkConfig configJs(@RequestParam(value = "url") String url) {
        return weChatService.getWechatJsSdkConfig(url);
    }

}
